#ifndef __L0032_0_SHMSTRUCT_H__
#define __L0032_0_SHMSTRUCT_H__

#define L0032_SHMSTRUCT_FLAGS_CREATOR			1

struct l0032_shmstruct {
	pthread_mutex_t lock;		// lock for new an entry
	size_t sz;
	uint8_t mem[];
};

#define L0032_SHMSTRUCT_LOCK(SHMSTRUCT)				(flock((SHMSTRUCT)->fd_lockfile, LOCK_EX))
#define L0032_SHMSTRUCT_UNLOCK(SHMSTRUCT)			(flock((SHMSTRUCT)->fd_lockfile, LOCK_UN))

struct l0032_shmstruct* l0032_shmstruct_open(const char* shmname, size_t sz, int bCreate);
void l0032_shmstruct_close(struct l0032_shmstruct* shmstruct);
void l0032_shmstruct_lock(struct l0032_shmstruct* shmstruct);
void l0032_shmstruct_unlock(struct l0032_shmstruct* shmstruct);

#endif
